﻿using HZY.Host.Admin.ApplicationServices.DevelopmentTools.LowCode.Impl;

namespace HZY.Host.Admin.Controllers.DevelopmentTools.LowCode;

[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找", DisplayName = nameof(LowCodeTableInfoController))]
public class LowCodeTableInfoController(IServiceProvider serviceProvider)
    : AdminControllerBase<LowCodeTableInfoService, LowCodeTableInfo, Guid, LowCodeTableInfo,
        LowCodeTableInfo>(serviceProvider)
{
    /// <summary>
    /// 同步表
    /// </summary>
    /// <returns></returns>
    [HttpPost("{tableId}")]
    public Task SynchronizationAsync([FromRoute] Guid tableId)
    {
        return Service.SynchronizationColumnByTableIdAsync(tableId);
    }

    /// <summary>
    /// 变更数据
    /// </summary>
    /// <param name="lowCodeTableInfos"></param>
    /// <returns></returns>
    [HttpPost]
    public Task ChangeAsync([FromBody] List<LowCodeTableInfo> lowCodeTableInfos)
    {
        return Service.ChangeAsync(lowCodeTableInfos);
    }
}